//
//  NSObject+Tools.m
//  SSFS
//
//  Created by Hero on 16/9/6.
//  Copyright © 2016年 北京山水风尚科技发展有限公司. All rights reserved.
//

#import "NSObject+Tools.h"
#import <objc/message.h>

@implementation NSObject (Tools)
static id accessoryObject;
/**设置一个辅助对象*/
- (void)setAccessoryObject:(id)object{
    objc_setAssociatedObject(self, &accessoryObject, object, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

/**得到辅助对象*/
- (id)getAccessoryObject{
    return objc_getAssociatedObject(self, &accessoryObject);
}

- (id)initWithDict:(NSDictionary *)dict{
    if (self = [self init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}

+ (id)modelWithDict:(NSDictionary *)dict{
    return [[self alloc] initWithDict:dict];
}
@end
